package SinglyLinkedList.SentinelLinkedList;

public class TestLinkedList {
  public static void main(String[] args) {
    SentinelLinkedList list1 = new SentinelLinkedList();
    list1.addFirst(3);
    list1.addFirst(2);
    list1.addFirst(1);
    list1.addLast(4);
    list1.addLast(5);

    list1.loop(value -> System.out.println(value));

    System.out.println("-----------------------------------");

    SentinelLinkedList list2 = new SentinelLinkedList();
    list2.addLast(1);
    list2.addLast(2);
    list2.addLast(3);
    list2.addLast(4);
    list2.addLast(5);

    list2.loop(value -> System.out.println(value));
    System.out.println(list2.getValue(4)); // 5
    System.out.println(list2.getValue(5)); // -1
    System.out.println(list2.getValue(-1)); // 666

    System.out.println("-----------------------------------");

    list2.insert(99, 0);
    list2.loop(value -> System.out.println(value));

    System.out.println(list2.remove(0)); // 99
  }
}
